package com.example.project7.model;

import java.io.Serializable;

public class Book implements Serializable {
    private String id;          // 唯一ID
    private String userEmail;   // 用户邮箱
    private String bookNumber;  // 书号
    private String bookName;    // 书名

    public Book() {
    }

    public Book(String id, String userEmail, String bookNumber, String bookName) {
        this.id = id;
        this.userEmail = userEmail;
        this.bookNumber = bookNumber;
        this.bookName = bookName;
    }

    // Getters and Setters
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    public String getBookNumber() {
        return bookNumber;
    }

    public void setBookNumber(String bookNumber) {
        this.bookNumber = bookNumber;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || getClass() != obj.getClass()) return false;
        Book book = (Book) obj;
        return id != null ? id.equals(book.id) : book.id == null;
    }

    @Override
    public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }
}